home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / CPP / VCW411.ZIP / TRIANGLE.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-10  |  2.0 KB  |  119 lines

  1. // -[Keep_Heading]-
  2.  
  3.  
  4. // -[Copyright_Mesg]-
  5. // --------------------------------------------------------------- //
  6. // (c) Copyright 1993-1994. Step Ahead Software Pty Limited. All rights reserved.
  7. // Class Source Filename: TRIANGLE.cpp
  8. // Description: 
  9. // Implements triangle objects.
  10. // --------------------------------------------------------------- //
  11.  
  12.  
  13. #include "TRIANGLE.h"
  14.  
  15.  
  16. // -[Keep_cpp_Extras]-
  17.  
  18.  
  19. // -[Module_Function_Decs]-
  20.  
  21.  
  22. // -[Module_Data_Decs_Def]-
  23.  
  24.  
  25. // -[Global_Data_Defs]-
  26.  
  27.  
  28. // -[Static_Member_Data_Defs]-
  29.  
  30.  
  31. // -[Function_Defs]-
  32.  
  33. // Returns a hash value
  34. hashValueType
  35. Triangle::hashValue() const
  36. {
  37.   return 0;
  38. }
  39.  
  40. void
  41. Triangle::write(Ropstream os)
  42. {
  43.   // Call to base class write functions
  44.   os << SideLength;
  45. }
  46.  
  47. Pvoid
  48. Triangle::read(Ripstream is)
  49. {
  50.   // Call to base class read functions
  51.   is >> SideLength;
  52.   return this;
  53. }
  54.  
  55. // Constructs the object before a stream input operation
  56. Triangle::Triangle(StreamableInit s)
  57.     : Shape(s)
  58.  
  59. {
  60. }
  61.  
  62. // Output Class Info
  63. void
  64. Triangle::printOn(Rostream outputStream) const
  65. {
  66. }
  67.  
  68. // Class Name
  69. char *
  70. Triangle::nameOf() const
  71. {
  72.   return "Triangle";
  73. }
  74.  
  75. // Tests Equality
  76. int
  77. Triangle::isEqual(const Object& testObject) const
  78. {
  79.   return FALSE;
  80. }
  81.  
  82. // Unique class ID
  83. classType
  84. Triangle::isA() const
  85. {
  86.   return TriangleClass;
  87. }
  88.  
  89. // Constructs the triangle with given side length.
  90. Triangle::Triangle(int InitX, int InitY, int InitSide)
  91.         : Shape(InitX, InitY)
  92. {
  93. }
  94.  
  95. // Draws an equilateral triangle of side length stored in the SideLength data
  96. // member.
  97. void
  98. Triangle::Show(HDC hDC)
  99. {
  100.     // Implementation left to the user as an exercise - 
  101.     // Famous quote found in just about every text book
  102.     // I have ever read!
  103. }
  104.  
  105.  
  106. // -[Persistent]-
  107. // OWL 1.0 streamability
  108. PTStreamable Triangle::build()
  109. {
  110.   return new Triangle(streamableInit);
  111. }
  112.  
  113. const Pchar Triangle::streamableName() const
  114. {
  115.   return "Triangle";
  116. }
  117.  
  118. TStreamableClass RegTriangle("Triangle", Triangle::build,
  119.   __DELTA(Triangle));